package org.example.reemploymentsys.repository;


import org.example.reemploymentsys.entity.UserTb;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserTbRe extends JpaRepository<UserTb, Long> , JpaSpecificationExecutor<UserTb> {
    @Query("select u.role.organization.id from UserTb u where u.username = ?1")
    String findOrgizationIdByUsername(String username);
    @Query("select u from UserTb u where u.role.organization.id = ?1")
    List<UserTb> findUserByOrgId(String organizationId);

    @Query("select u from UserTb u where u.username = ?1")
    UserTb findUserByUsername(String name);

    @Query("select u from UserTb u where u.role.roleName = ?1")
    UserTb findUserByRoleName(String superAdmin);
}
